<template>
	<div class="footer">
		<div 
		v-for='(item,index) of items' 
		:key="index"
		:class='[item.cls,{on:index === idx}]' 
		@click="$router.push(item.push)">
			<img :src="index===idx?item.iconSelect:item.icon">
			<p :class="['colorChange',{on:index===idx}]" >{{item.name}}</p>
		</div>
 
	</div>
</template>

<script>
export default {
  name: 'Tabbar',
  props:['idx'],
  data(){
			return {
				items:[{
					cls:"home",
					name:"首页",
					push:"/index",
					icon:require('../../assets/b_icon1.png'),
					iconSelect:require('../../assets/a_icon1.png'),
				},
				{
					cls:"shares",
					name:"交易",
					push:"/trade",
					icon:require('../../assets/b_icon2.png'),
					iconSelect:require('../../assets/a_icon2.png'),
				},
				{
					cla:"community",
					name:"OTC",
					push:"/otc",
					icon:require('../../assets/b_icon3.png'),
					iconSelect:require('../../assets/a_icon3.png'),
				},
				{
					cla:"mine",
					name:"资产",
					push:"/asset",
					icon:require('../../assets/b_icon4.png'),
					iconSelect:require('../../assets/a_icon4.png'),
				},
				{
					cla:"mine",
					name:"我的",
					push:"/mine",
					icon:require('../../assets/b_icon5.png'),
					iconSelect:require('../../assets/a_icon5.png'),
				}]
			}
		}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">

.footer{
	display: flex;
	border-top: 1px solid #f1f1f1;
	z-index: 4;
	position: fixed;
	left: 0;
	bottom: 0;
	box-sizing: border-box;
	height: 1.333333rem;
	background: #fff;
	width: 100%;
	align-items: center;
		div{
			flex: 1;
			font-size: .32rem;
			p{
				color:#B0B6CB;
			}
			img{
				width: .613333rem;
				height: .613333rem;
			}
			.on{
			color: #F57D13;
			}
		}
	}
</style>
